package com.huawei.appmarket.oobe.app;

import android.app.job.JobInfo.Builder;
import android.app.job.JobParameters;
import android.app.job.JobScheduler;
import android.app.job.JobService;
import android.content.ComponentName;
import android.content.Context;
import android.os.Build.VERSION;
import androidx.annotation.RequiresApi;
import o.dli;
import o.dlm;
import o.Logger;

@RequiresApi(api = 21)
public class OOBEDownloadJobService extends JobService {
    public static void schedule(Context context) {
        int i = 1;
        if (VERSION.SDK_INT >= 26) {
            JobScheduler jobScheduler = (JobScheduler) context.getSystemService("jobscheduler");
            int i2 = (dli.ˊ(context).getInt("userSelectNetType", 4) & 1) != 0 ? 1 : 0;
            Builder periodic = new Builder(1001, new ComponentName(context.getPackageName(), OOBEDownloadJobService.class.getName())).setPersisted(true).setPeriodic(300000);
            if (i2 == 0) {
                i = 2;
            }
            jobScheduler.schedule(periodic.setRequiredNetworkType(i).build());
            Logger.ˎ("OOBE", "OOBEDownloadJobService scheduled");
        }
    }

    public boolean onStartJob(JobParameters jobParameters) {
        Logger.ˎ("OOBE", "OOBEDownloadJobService onStartJob");
        dlm.ˎ();
        return false;
    }

    public boolean onStopJob(JobParameters jobParameters) {
        return true;
    }
}
